#ifndef __SENSORS_DATA__
#define __SENSORS_DATA__

#include <stdarg.h>
#include <unistd.h>

#include <string.h>

#include <signal.h>
#include <errno.h>
#include "get_file_properties.h"
#include "get_temp.h"

#define SEND_SENSORS_DATA_PORT "/dev/ttyAMA0" //ttyAMA0或ttyS0 具体看树莓派映射关系
#define GPS_RECV_DATA_HEART "$GPGGA"

typedef struct
{
    int tm_sec; //seconds   0-61

    int tm_min; //minutes   1-59

    int tm_hour; //hours   0-23

    int tm_mday; //day   of   the   month   1-31

    int tm_mon; //months   since   jan   0-11

    int tm_year; //years   from   1900

    int tm_wday; //days   since   Sunday,   0-6

    int tm_yday; //days   since   Jan   1,   0-365

    int tm_isdst; //Daylight   Saving   time   indicator
} tm;

typedef struct
{
    int years;
    int months;
    int days;
    int hours;
    int minutes;
    int seconds;
} recvTimeStruct;

typedef struct _WXT_Packet_Header
{
    char mark;  // '$'
    char mark1; //'@'
    char type;  //0:传感器数据 1：采样抽水数据 2:系统时间
    int msg_id; //未使用
    int padlen; //数据长度  （采样抽水数据则长度为4字节，传感器长度为数据结构体大小）
} WXT_Packet_Header;

typedef struct
{
    __time_t tv_sec;       /* Seconds. */
    __suseconds_t tv_usec; /* Microseconds. */
} timeval;

void getSensorsDataCallBack(void (*sendSensorsDataToUart)(char *, int, char));

void pumpSaveGpsTimeToFile();

#endif